package com.air.designmodel.two;

import com.air.designmodel.two.behavior.impl.FlyRocketPowered;
import com.air.designmodel.two.behavior.impl.MuteQuack;
import com.air.designmodel.two.behavior.impl.Squeak;
import com.air.designmodel.two.entity.DuckCall;
import com.air.designmodel.two.entity.father.Duck;
import com.air.designmodel.two.entity.son.MallardDuck;
import com.air.designmodel.two.entity.son.ModelDuck;

/**
 * 策略模式测试类
 *
 * @author shent
 */
public class MainTest {
    public static void main(String[] args) {
        Duck mallardDuck = new MallardDuck();
        mallardDuck.performQuack();
        mallardDuck.performFly();
        mallardDuck.display();
        mallardDuck.swim();

        Duck modelDuck = new ModelDuck();
        modelDuck.setFlyBehavior(new FlyRocketPowered());
        modelDuck.setQuackBehavior(new Squeak());
        modelDuck.performFly();
        modelDuck.performQuack();

        DuckCall duckCall = new DuckCall();
        duckCall.setQuackBehavior(new MuteQuack());
        duckCall.performQuack();
    }

}
